import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/modules/billing/page/billing/billingList.dart';
import 'package:honeypotflutter/modules/billing/views/billing_header.dart';
import 'package:honeypotflutter/public/views/public_appBar.dart';
import 'package:honeypotflutter/public/views/public_tabBar_scrollView.dart';
import 'logic.dart';

class BillingPage extends StatefulWidget {
  const BillingPage({Key? key}) : super(key: key);

  @override
  State<BillingPage> createState() => _BillingPageState();
}

class _BillingPageState extends State<BillingPage> {
  final BillingLogic logic = Get.put(BillingLogic());

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    logic.calculateDate();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: HLAppBar(
        navigationTitle: "明细",
      ),
      body: Padding(
        padding: EdgeInsets.only(left: 12, right: 12),
        child: Column(children: [
          BillingHeader(),
          Expanded(
              child: HLTabBarScrollView(
                  mens: ["全部", "收入", "支出"],
                  radius: 8,
                  children: [
                    BillingList(
                      tag: "202401",
                      refreshController: logic.allRefreshController,
                    ),
                    BillingList(
                      tag: "202402",
                      refreshController: logic.inComeRefreshController,
                      billType: 1,
                    ),
                    BillingList(
                      tag: "202403",
                      refreshController: logic.outRefreshController,
                      billType: 2,
                    )
                  ]))
        ]),
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<BillingLogic>();
    super.dispose();
  }
}
